import Mock from "mockjs";
import { Local } from "../utils";
class documentEntity {
  fieldsSession = Local('documentEntity-fields', Mock.mock({
    title: "@ctitle(8)",
    content: "@cword(120)",
  }))
  get fields() {
    return this.fieldsSession.get();
  }
  set fields(obj: any) {
    this.fieldsSession.set(obj)
  }
  findAll() {
    return this.fields;
  }
  updateOne(field: string, val: any) {
    let obj = this.findAll();
    obj[field] = val;
    this.fields = obj;
    return this.fields[field];
  }
}

export default documentEntity;